package ATM;

import javax.swing.*;
import java.awt.*;


public class ATMFrame extends JFrame {
    private CardLayout cardLayout = new CardLayout();
    private Image bgImg = new ImageIcon("src/ATM/image/background.jpg").getImage();


    private LoginPanel loginPanel = new LoginPanel(this);
    private MenuPanel menuPanel = new MenuPanel(this);
    private GetPanel getPanel = new GetPanel(this);
    private ChangePwdPanel changePwdPanel = new ChangePwdPanel(this);
    private SavePanel savePanel = new SavePanel(this);
    private SearchPanel searchPanel = new SearchPanel(this);
    private TransferPanel transferPanel = new TransferPanel(this);


    public ATMFrame(){


        this.setContentPane(new JPanel(){
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(bgImg,0,0,this);
            }
        });


        this.setLayout(cardLayout);

        this.add(loginPanel,"login");
        this.add(menuPanel,"menu");
        this.add(changePwdPanel,"changePwd");
        this.add(getPanel,"get");
        this.add(savePanel,"save");
        this.add(searchPanel,"search");
        this.add(transferPanel,"transfer");


        this.setTitle("欢迎使用中国银行ATM");
        this.setSize(1024, 768);
        this.setLocationRelativeTo(null);
        this.setResizable(false);
//        this.setUndecorated(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);





    }
    public void showPanel(String name){
        cardLayout.show(this.getContentPane(),name);
    }
}
